<template>
    <a-tooltip placement="topLeft">
        <template #title>
            <span>{{ tip }}</span>
        </template>
        <a-select v-model:value="value" :mode="mode" :placeholder="placeholder" :dropdownMatchSelectWidth="true" style="min-width: 200px;">
            <a-select-option v-if="is_all" :value="0">全部</a-select-option>
            <a-select-option v-for="item in option" :value="item[index]">{{ item[label] }}</a-select-option>
        </a-select>
    </a-tooltip>
</template>

<script setup lang="ts">
    import { nextTick, ref } from "vue";
    const value = defineModel('value')
    const props = defineProps<{
        option: any[]
        index?: any
        label?: any
        tip?: string
        mode?: string
        placeholder?: string
    }>()
    const is_all = ref<boolean>(true);
    nextTick(() => {
        is_all.value = (props.mode || '') == ''
    })
</script>
